from core.Airtest import AppAutomation

class StartApp():
    def __init__(self):
        self.kuke = AppAutomation()

    def start(self):
        """启动应用并执行初始化操作"""
        self._open_app()
        self._handle_advertisement()
        self._login()

    def _open_app(self):
        """打开应用"""
        self.kuke.click("库课网校")
        # 等待应用启动并检测到需要的元素
        self.kuke.wait_for_element("tpl1736993968628.png")

    def _handle_advertisement(self):
        """处理广告"""
        self.kuke.handle_advertisement()

    def _login(self):
        """执行登录操作"""
        self.kuke.click("com.kuke:id/tv_login")